package com.ars.common.servlet.admin;

import com.ars.common.dao.DeleteUser;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;

@WebServlet("/deleteUser")
public class deleteServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
       String id = request.getParameter("id");
        DeleteUser de = new DeleteUser();
        System.out.println("deleteUser-test");
        try {
            de.delete(id);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }

        String url = request.getContextPath() + "/UserInfo";
        response.sendRedirect(url);

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
